
export function addticket2page(Loc,Renwu,steps){
    elmGetter.get('[id="operationTask"]').then(task =>{
        console.log(task);
        task.value = Renwu;
        task.dispatchEvent(
            new Event("change", {
                view: window,
                bubbles: true,
                cancelable: true,
            })
        );
    });
    elmGetter.get('[id="functionLocationName"]').then(task =>{
        console.log(task);
        task.value = Loc;
        task.dispatchEvent(
            new Event("change", {
                view: window,
                bubbles: true,
                cancelable: true,
            })
        );
    });
    elmGetter.get('[data-index="1"]').then(task =>{
        // startstepnum=task.parentElement.children.length==1? task.parentElement.children.length:task.parentElement.children.length+1;
        let startstepnum=task.parentElement.children.length;
        console.log(startstepnum);
        elmGetter.get('[id="append-'+startstepnum+'"]').then(task =>{
            task.value=startstepnum==1? steps.length-1:steps.length;
            task.dispatchEvent(
                new KeyboardEvent('keyup',{
                    key:'Return',
                    keyCode:'13',
                })
            ); 
            let n=startstepnum==1? 0:1;
            for(let i=0;i<=steps.length-1;i++){
                elmGetter.get('[id="operationStep-'+(startstepnum+n+i)+'"]').then(task =>{
                    console.log(task);
                    console.log(startstepnum+i);
                    task.value=steps[i];
                });
            }
        });
        
    });
}